package com.google.code.scalaxmljaxen

import scala.xml._

class NodeSeqX(val self: NodeSeq) {
  
  def createXPath(expr: String) = new ScalaXmlXPath(expr)
  
  def numberValueOf(expr: String): Double = createXPath(expr).numberValueOf(self).doubleValue
  
  // XXX: select nodes
  
  def selectObject(expr: String) = createXPath(expr).selectSingleNode(self)
  
  def selectSingleNode(expr: String) = selectObject(expr).asInstanceOf[NodeSeq]
  
  def selectSingleElement(expr: String) = selectObject(expr).asInstanceOf[Elem]
  
  //def selectNodes(expr: String) = 
  
  //def selectElements(expr: String) = 
  
  def valueOf(expr: String) = createXPath(expr).valueOf(self)
}

object NodeSeqX {
  implicit def xmlToX(ns: NodeSeq) = new NodeSeqX(ns)
}